import request from '@/utils/request'

/**
 * 分页查询
 * @param {*} page 
 * @param {*} size 
 * @param {*} searchMap 
 * @returns 
 */
export function search(page, size, searchMap) {
    return request({
        url: `/role/list/search/${page}/${size}`,
        method: "post",
        data: searchMap
    })
}

/**
 * 新增角色
 * @param {*} pojo 
 * @returns 
 */
export function add(pojo) {
    return request({
        url: '/role',
        method: 'post',
        data: pojo
    });
}

/**
 * 通过ID查询角色
 * @param {*} id 
 * @returns 
 */
export function getById(id) {
    return request({
        url: `/role/${id}`,
        method: 'get'
    });
}

/**
 * 更新角色
 * @param {*} pojo 
 * @returns 
 */
export function update(pojo) {
    return request({
        url: `/role/${pojo.id}`,
        method: 'put',
        data: pojo
    });
}

/**
 * 通过ID删除程序角色
 * @param {*} id 
 * @returns 
 */
export function deleteById(id) {
    return request({
        url: `/role/${id}`,
        method: 'delete'
    });
}
